/******************************************************************************
 * The contents of this file are subject to the   JDI License  Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Initial Developer of the Original Code is 陈慧然. Portions created by 
 * 陈慧然 are Copyright 陈慧然.
 * All Rights Reserved.
 *
 *              Contact john_holen@163.com for licensing alternatives.
 *
 *****************************************************************************/


package org.peony.db.base;

import java.sql.Connection;

import org.peony.db.mysql.MysqlDBOFactory;
import org.peony.db.oracle.OracleDBOFactory;
import org.peony.db.sqlServer.SqlServerDBOFactory;
import org.peony.exceptions.ConfigException;
import org.peony.models.MApplicationConfig;
import org.peony.standard.db.operation.SIJDBCDatabaseOperation;
import org.peony.standard.unvarying.db.DBType;

/**
 *  
 *
 *  @author     陈慧然
 *  @version    Id: Conn.java, v 0.000 2008-6-15 下午02:35:07 陈慧然 Exp
 */
public abstract class DBOAbstractFactory {
	public static DBOAbstractFactory getFactory(int dbmsType) throws ConfigException{
		int databaseType = dbmsType;
		DBOAbstractFactory dbo;
		if(databaseType == DBType.MYSQL)
			dbo = new MysqlDBOFactory();
		else if(databaseType == DBType.ORACLE)
			dbo = new OracleDBOFactory();
		else if(databaseType == DBType.SQLSERVER)
			dbo = new SqlServerDBOFactory();
		else
			throw new ConfigException (ConfigException.ERRORDBMSTYPE);
		return dbo;
	}
	
	public abstract SIJDBCDatabaseOperation getDBO();
}
